]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Use StSettings for primary-paste setting
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 30 Jan 2019 18:56:18 +0000 (19:56 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 30 Jan 2019 22:18:53 +0000 (23:18 +0100)
If middle-click happens, check whether the setting is enabled
and paste primary selection if so.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317

src/st/st-entry.c

index 4fdfda0e33bb786c5d9453226cf4d930b0987fdc..2d1de36ef9f7b4664b5063be9ec17ab75f975804 100644 (file)
@@ -56,6 +56,7 @@
 
 #include "st-icon.h"
 #include "st-label.h"
+#include "st-settings.h"
 #include "st-widget.h"
 #include "st-texture-cache.h"
 #include "st-clipboard.h"
@@ -644,29 +645,32 @@ clutter_text_button_press_event (ClutterActor       *actor,
                                  gpointer            user_data)
 {
   StEntryPrivate *priv = ST_ENTRY_PRIV (user_data);
-  GtkSettings *settings = gtk_settings_get_default ();
-  gboolean primary_paste_enabled;
 
-  g_object_get (settings,
-                "gtk-enable-primary-paste", &primary_paste_enabled,
-                NULL);
-
-  if (primary_paste_enabled && event->button == 2
-      && clutter_text_get_editable (CLUTTER_TEXT (priv->entry)))
+  if (event->button == 2 &&
+      clutter_text_get_editable (CLUTTER_TEXT (priv->entry)))
     {
-      StClipboard *clipboard;
+      StSettings *settings;
+      gboolean primary_paste_enabled;
 
-      clipboard = st_clipboard_get_default ();
+      settings = st_settings_get ();
+      g_object_get (settings, "primary-paste", &primary_paste_enabled, NULL);
 
-      /* By the time the clipboard callback is called,
-       * the rest of the signal handlers will have
-       * run, making the text cursor to be in the correct
-       * place.
-       */
-      st_clipboard_get_text (clipboard,
-                             ST_CLIPBOARD_TYPE_PRIMARY,
-                             st_entry_clipboard_callback,
-                             user_data);
+      if (primary_paste_enabled)
+        {
+          StClipboard *clipboard;
+
+          clipboard = st_clipboard_get_default ();
+
+          /* By the time the clipboard callback is called,
+           * the rest of the signal handlers will have
+           * run, making the text cursor to be in the correct
+           * place.
+           */
+          st_clipboard_get_text (clipboard,
+                                 ST_CLIPBOARD_TYPE_PRIMARY,
+                                 st_entry_clipboard_callback,
+                                 user_data);
+        }
     }
 
   return FALSE;